package edu.unlv.cs.ladders.web;

import edu.unlv.cs.ladders.entities.Tournament;
import java.lang.Boolean;
import java.lang.String;
import java.util.Calendar;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

privileged aspect TournamentController_Roo_Controller {
    
    @RequestMapping(value = "find/ByClosed/form", method = RequestMethod.GET)
    public String TournamentController.findTournamentsByClosedForm(ModelMap modelMap) {
        return "tournament/findTournamentsByClosed";
    }
    
    @RequestMapping(value = "find/ByClosed", method = RequestMethod.GET)
    public String TournamentController.findTournamentsByClosed(@RequestParam("closed") Boolean closed, ModelMap modelMap) {
        if (closed == null) throw new IllegalArgumentException("A Closed is required.");
        modelMap.addAttribute("tournaments", Tournament.findTournamentsByClosed(closed).getResultList());
        return "tournament/list";
    }
    
    @RequestMapping(value = "find/ByClosedAndEndDateLessThan/form", method = RequestMethod.GET)
    public String TournamentController.findTournamentsByClosedAndEndDateLessThanForm(ModelMap modelMap) {
        modelMap.addAttribute("tournament_endDate_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        return "tournament/findTournamentsByClosedAndEndDateLessThan";
    }
    
    @RequestMapping(value = "find/ByClosedAndEndDateLessThan", method = RequestMethod.GET)
    public String TournamentController.findTournamentsByClosedAndEndDateLessThan(@RequestParam("closed") Boolean closed, @RequestParam("endDate") @DateTimeFormat(style = "S-") Calendar endDate, ModelMap modelMap) {
        if (closed == null) throw new IllegalArgumentException("A Closed is required.");
        if (endDate == null) throw new IllegalArgumentException("A EndDate is required.");
        modelMap.addAttribute("tournaments", Tournament.findTournamentsByClosedAndEndDateLessThan(closed, endDate).getResultList());
        modelMap.addAttribute("tournament_endDate_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        return "tournament/list";
    }
    
}
